home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Tele / C / Comet2.1.3.cpt / include / em.h < prev    next >
Text File  |  1991-10-22  |  28KB  |  812 lines

  1. /*
  2.     Copyright Cornell University 1986.  All rights are reserved.
  3.  
  4. */
  5.  
  6. /* mode flags */
  7. #ifndef _EMDEF
  8. #define _EMDEF
  9.  
  10. #ifndef _TYPES            /* don't include system stuff if already included */
  11. #include <notice.h>
  12.  
  13. #include <types.h>
  14. #include <stdio.h>
  15. #include <osutil.h>
  16. #include <quickdraw.h>
  17. #include <toolutil.h>
  18. #include <window.h>
  19. #include <control.h>
  20.  
  21. #include <desk.h>
  22. #include <segment.h>
  23. #include <event.h>
  24. #include <packages.h>
  25.  
  26. #include <resource.h>
  27. #include <font.h> 
  28. #include <menu.h>
  29. #include <textedit.h>
  30. #include <dialog.h> 
  31. #include <memory.h>
  32. #include <pb.h>
  33. #include <print.h>
  34. #include <scrap.h>
  35.  
  36. #endif
  37.  
  38.  
  39. /* #ifdef MACTCP */
  40. #include     <MacTCPCommonTypes.h>
  41. #include    <TCPPB.h>
  42. /*
  43. #endif
  44. */
  45.  
  46. #include <key.h>
  47. #include <q.h>
  48. #include <timer.h>
  49. #include <telnet.h>
  50. #include <ft.h>
  51. #include <emdefs.h>
  52.  
  53. extern unsigned long getmya5();        /* returns old a5, sets our a5 global data * */
  54. extern short reopenconfig();
  55.  
  56. struct hostsock {
  57.     union {
  58.         char bytes[4];
  59.         unsigned long addr;
  60.     } u;
  61.     unsigned port;                /* TCP port to connect to */
  62.     short hostconnact;            /* ID of macro to execute after host connection complete */
  63. };
  64.  
  65. /* 
  66.     ibmcolormap array is organized as an array of RGB values:
  67.  
  68.     [unprotected, protected]
  69.         X
  70.     [normal, sense, intense, invis]
  71.         X
  72.     [foreground, background] 
  73. */
  74.  
  75. struct ibmcolormap {
  76.     RGBColor colors[MAXCOLORS];
  77. } ;                                    /* colormap */
  78.  
  79. extern struct ibmcolormap ibmcolormap;
  80. extern struct ibmcolormap asccolormap;
  81.  
  82.  
  83.  
  84. struct windtext {            /* structure with items required for useful TE */
  85.     TEHandle    texthand;                /* with a TextEdit box and a scrollbar */ 
  86.     short         textscrapped;            /* the TE scrap has been touched and must be coerced */
  87.     int            FirstLine;                /* the number of the line at the top */
  88.     short         textlines;                /* # of lines in page */
  89.     ControlHandle scrollhand;            /* vertical scroll bar control */
  90. };
  91.  
  92. /* 
  93.     this is the enormous window structure comprising everything 
  94.     the joint tradition of 3 separate programs, h19, tn, and tn3270,
  95.     knows about a window.
  96.     
  97.     Major globals:
  98.     
  99.     keydp -> the topmost winds structure, to which user key and mouse 
  100.             routines refer;
  101.     keywindow -> its WindowRecord;
  102.     
  103.     emdp -> the current output winds structure context to which emulator
  104.             I/O routines refer;
  105.     emwindow -> its WindowRecord;
  106. */
  107.  
  108. struct winds {
  109.     WindowPtr emwindow;
  110.     WindowPtr iconwindow;
  111.     WindowPtr textwindow;
  112.  
  113.     short conntype;                    /* 0 TCP 1 Serial Driver 2 Comm Mgr */
  114.     short disposeonclose;            /* close window/window document completely on close */
  115.     Handle connmacro;                /* handle to macro to execute on connection */
  116.     Handle closemacro;                /* handle to macro to execute before close */
  117.     Handle hlasthost;                /* TCP/IP host address resource handle c string */
  118.     Handle hhostname;                /* host name actually accessed pascal string */
  119.     
  120.     Handle clickmacro;                /* macro to execute on double-click */
  121.  
  122.     short icon_up;                    /* icon window up */
  123.  
  124. /* from config.c */
  125.     
  126.     AppFile appfile;                /* SFGet/PutFile record */
  127.     short resfid;                    /* resource file descriptor */
  128.     short resvol;                    /* resource home volume */
  129.     long resdir;                    /* resource home directory */
  130.     short confchanged;                /* the configuration has been modified */
  131.     short newconf;                    /* this is a new, unopened configuration */
  132.     
  133. /* .edit textedit window */
  134.     short logsession;                /* log session screen clears/scrollups in .edit */
  135.     short hidetextwindow;        /* textwindow: don't show the text window */
  136.     short edit;                    /* the text edit window is up */
  137.     short editload;                /* load automatically on upload/download */
  138.     short editupwrap;            /* wrap automatically on upload */
  139.     short editdownwrap;            /* wrap automatically on download */
  140.     TEHandle texthand;            /* TE text appearing in textwindow */
  141.     short textscrapped;            /* the TE scrap has been touched and must be coerced */
  142.     int FirstLine;                /* the number of the line at the top */
  143.     short textlines;            /* # of lines in page */
  144.     ControlHandle vBarHand;        /* scroll bar control */
  145.  
  146. /* save screen file output */
  147.     short savefid;                    /* id of file opened for saving screens */
  148.     SFReply reply;                    /* file open record */
  149.  
  150. /* items for file logging */
  151.     short filesession;            /* log session in a file */
  152.     SFReply logreply;            /* log file open record */
  153.     short logfid;                /* id of file opened for logging session */
  154.  
  155.     short logerase;                /* log/file text erased by ASCII emulator */
  156.  
  157. /* per window variables telnet.c */
  158.     
  159.     struct hostsock fhost;            /* host address */
  160.     short connopen;                    /* is connection open */
  161.     short telmode;                    /* telnet interpretation mode */
  162.     short termtype;                    /* index for trying different types */
  163.     struct ucb ucb;                    /* user preferences from config file */
  164.     short subnegofail;
  165.     short userquit;                    /* user quitting */
  166.     char tnbinary;                    /* BINARY negotiated? (for 3270) */
  167.     char tneor;                        /* EOR negotiated? (for 3270) */
  168.     char tndata;                    /* flag that data has arrived on connection */
  169.     char disableterm[12];            /* table for getting disabled termtypes */
  170.     short termset;                    /* term type selected, OK to output... */
  171.     short termrepeat;                /* repeating last terminal type in list */
  172.     
  173. /* TNdrvr interface vars */
  174.     Boolean hycnewdata;                /* new data has arrived since last driver call */
  175.     Boolean hycactive;                /* driver interface active */
  176.     short hycconnwait;                /* connection requested but not complete */
  177.  
  178. /* per window vars from event.c */
  179.     
  180.     short backonly;                    /* run only in background */
  181.     short autoshrink;                /* shrink automatically on suspend/resume */
  182.     char delayactions;                /* hold macros until timer pops */
  183.     unsigned long event_reg;        /* flags for events that need servicing (mostly 3270) */
  184.     short mfwait;                    /* wait for MF updates before drawing */
  185.  
  186. /* mode flags */
  187.     
  188.     /* input control */
  189.     
  190.     short ibm_mode;                    /* use IBM 3270 rather than ASCII em I/O */
  191.     short userxoff;                    /* user has done ^S */
  192.     char delaytokens;                /* hold macro tokens until timer pops */
  193.     timer *token_tm;                /* timer for resuming token interpretation */
  194.     
  195. /* key.c */
  196.  
  197.     short ibm_keymode;                    /* differentiate for 7171 serial access */
  198.     short keypadswitch;                /* switch +/- on standard keyboard keypad */
  199.     
  200.         /* ASCII */
  201.     short ba_bs;                        /* if FALSE, map BS to DELETE */
  202.     short escmap;
  203.     short crtonl;                        /* map carriage return to newline */
  204.     
  205.         /* IBM */
  206.     short keypad;                        /* keypad mode */
  207.     short typeahead;                    /* do typeahead */
  208.     short pfshift;                        /* shift next PF key up by 12 */
  209.     short pfdubshift;                    /* shift next PF key up by 24 */
  210.     
  211. /* macro.c */
  212.  
  213.     short dokeymacros;                    /* like it says */
  214.     short macroexecuting;                /* prettywind tokens remain on q, the macro flag is highlighted */
  215.     short keyaltset;                    /* match alt (mouse down) state when matching macro */
  216.     struct keyxlist * keyxhead;
  217.     struct token actqueue[MAX_Q];        /* TODO dynamic? the token buffer */
  218.     short q_head;
  219.     short q_tail;
  220.     short q_cnt;
  221.     char tokenhold;                        /* save tokens we've handed up so we can loop */
  222.     char matchinput;                    /* match input loop mode */
  223.     short loopcount;                    /* # of times to loop, -1 = forever */
  224.     unsigned short tokencount;            /* count of tokens in loop */
  225.     
  226.     /* state for token interpreter */
  227.     int gotoy;
  228.     int nselystart;                        /* selection rectangle */
  229.     int nselxstart;
  230.     int nselyend;
  231.     int nselxend;
  232.  
  233. /* drawing vars for all emulators screen.c vt100.c h19.c asciidraw.c */
  234.  
  235.     char emdisable;                    /* don't update screen */
  236.     char dsdraw;                    /* use direct to screen drawing */
  237.     short color;                    /* use color on the screen */
  238.     short inselection;                /* ascii flag for ds draw */
  239.     Rect gdRect;                    /* dsdraw display global coordinates */
  240.  
  241.     short lastrow;                    /* ASCIIlast row of  emulator, counting from 0 */
  242.     short screensize;                /* ASCII emulator screen size */
  243.     short emliteral;                /* ASCII literal output */
  244.     
  245.     /* the following are function pointers for directscreen v. quickdraw functions */
  246.     
  247. /* font IDs */
  248.  
  249.     short normfont;                /* normal font ID */
  250.     short highfont;                /* bold font ID */
  251.     short vtfont;                /* vt100 graphics font ID */
  252.  
  253.     int    (*screen_upd)();        /* update the emulator screen */
  254.     int    (*updatewind)();        /* update the whole window */
  255.     int    (*clear_scr)();            /* clear the screen */
  256.  
  257.     /* IBM 3270 */
  258.     int    (*ch_draw)();            /* draw a single character */
  259.     int    (*str_draw)();            /* draw a string */
  260.     int    (*prepibmdraw)();        /* set up screen for drawing */
  261.     
  262.     /* ASCII routines */
  263.     int (*scrollup)();            /* -> routine which does bit scrolling */
  264.     int (*emstr)();                /* -> emstr(ptr, count) routine */
  265.     int (*em)();                /* -> em(char) routine */
  266.  
  267. /* BIGG variables following are copied to/from globals */
  268.  
  269. /* shared by all emulators */
  270.     
  271. /* direct to screen stuff */
  272.  
  273.     unsigned long modflg;            /* BIGG line modified bit array */
  274.     unsigned long clrflg;            /* BIGG line cleared bit array */
  275.  
  276.     FONTS * thefont;                /* BIGG default font */
  277.     short ** startarr;                /* BIGG dsdraw -> array of ptrs to scanline starts */
  278.     short screenbytes;                /* BIGG width of screen in bytes */
  279.     short screenrem;                /* BIGG screenbytes - std screen */
  280.     short * screenbase;                /* -> the screen PixMap */
  281.     
  282.     short     xpos;
  283.     short    ypos;                    /* BIGG current x, y position */
  284.     
  285.     Rect zaprect;                    /* for ShieldCursor */
  286.  
  287. /* h19 */
  288.  
  289.     short mode;                        /* BIGG interpretation mode of emulator */
  290.     short inserton;                    /* BIGG insert mode */
  291.     unsigned char attrib;            /* BIGG normal/reverse mode for copy drawing */
  292.     short wrap_around;                /* BIGG wrap at end of line if true */
  293.  
  294.     unsigned char * charp;            /* BIGG ASCII -> cursor location in charr */
  295. #ifdef VARVTSIZE
  296.     unsigned char * charr;            /* * character/attribute array for screen */
  297.     char * tabset;                    /* * tab settings array */
  298. #else
  299.     unsigned char charr[2 * SCREENSIZE];
  300.     char tabset[MAXLINELENGTH];
  301. #endif
  302.  
  303.     unsigned char * charrend;
  304.     unsigned char * atarr;            /* attributes on screen SAME AS CHARREND! */
  305.     unsigned char * secondline;
  306.     unsigned char * lastline;
  307.     
  308.     long size23;
  309.     short linecount;                /* # of rows */
  310.     short linelength;                /* BIGG width of row */
  311.     short lastcol;                    /* BIGG linelength - 1 */
  312.     Rect bigrect;                    /* for line insert, delete -- surrounds em area at margin */
  313.     Rect scrollrect;                /* current scrolling rect */
  314.         
  315. /* vt100; uses most h19 vars also */
  316.  
  317.     short vtmode;                    /* BIGG new mode holder for vt100 */
  318.     unsigned short * argp;            /* BIGG -> current argument */
  319.     unsigned char charset;            /* BIGG character set in use (normal, vtgraphics) */
  320.     
  321. /* 3270 */
  322.     /* variables important to the 3270 interpreter */
  323.     
  324.     unsigned char *scr_map;            /* BIGG screen map */
  325.     unsigned char *smap_end;        /* BIGG end of map */
  326.     unsigned char *scr_org;            /* BIGG temporary base of map due to write+SBA only    */
  327.     unsigned char *current_attr;    /* BIGG pointer to most recent attribute */
  328.     unsigned char *cursor_ptr;        /* BIGG current cursor position in screen map */
  329.     unsigned char * firstp;            /* BIGG ptr to first data byte processed for set_map */
  330.     unsigned char realattr;            /* BIGG mask for relevant attributes */
  331.  
  332.     short cmdstate;                    /* BIGG state of the emulator */
  333.     unsigned char * savcurptr;        /* BIGG saves curptr */
  334.     unsigned short savcount;        /* BIGG various counters which need to be saved between calls */
  335.     short savdata;                    /* BIGG saves haddata */
  336.  
  337.     short scr_flag;                    /* BIGG */
  338.  
  339. /* BIGG end of copy range */
  340.  
  341. /* shared variables */
  342.  
  343.     /* cursor modes */
  344.     short curson;                    /* cursor state, on or off */
  345.     short blockcurs;                /* block vs. underline cursor */
  346.     short changecurs;                /* make cursor blink */
  347.     Rect cursrect;                    /* inviolable cursor Rect */
  348.     
  349.     /* set globals to certain screen constants to eliminate calculations */
  350.     
  351.     short voffset;                /* offsets of em display from origin */
  352.     short hoffset;
  353.     short ctloffset;
  354.     
  355.     short fontsize;                /* the usual wrong size spec, # bits above base */
  356.     short lineheight;            /* line height including leading */
  357.     short fontheight;            /* the actual height of font */
  358.     short fontdescent;            /* # of descending bits in font */
  359.     short fontwidth;            /* BIGG width of font */
  360.     
  361.     short bottommarg;            /* bottom margin of emulator area */
  362.     short rightmarg;            /* right margin of emulator area */        
  363.     short mrecttop;                /* offset to top of mouse tracking rectangle */
  364.     short mrectbot;                /* offset to bottom of mouse tracking */
  365.     
  366.     short curstop;                /* top of the cursor */
  367.     
  368.     char cursorwait;                /* cursor needs to be moved after mfwait */
  369.     
  370.     timer *sel_tm;                    /* timer for redrawing selection on screen */
  371.     
  372.     short selrectset;            /* selection has been made */
  373.     short selrectvis;            /* selection is visible */
  374.     short copytable;            /* use table mode when copying selection? */
  375.     Rect seltoprect;            /* rectangle for top portion of selection range */
  376.     Rect selmidrect;            /* rectangle for middle portion of selection range */
  377.     Rect selbotrect;            /* rectangle for bottom portion of selection range */
  378.     short seltopset;
  379.     short selmidset;
  380.     short selbotset;
  381.     short selystart;                /* x & y coordinates where the selection starts & ends */
  382.     short selxstart;
  383.     short selyend;
  384.     short selxend;
  385.     short starty;                    /* coordinates we do sel extends around */
  386.     short startx;
  387.     short selfirsttime;
  388.     
  389. /* 3270 */
  390.  
  391.     short  ayt_sent;                /* if 1, Are You There has just been sent */
  392.     unsigned char aid_key;            /* most recent AID */
  393.     short nullsareblanks;            /* causes imbedded nulls to be sent as blanks */
  394.     short squeezeblanks;            /* squeeze blanks and not just nulls on insert */
  395.     short shiftfield;                /* shift all chars in field, not just row */
  396.     
  397.     struct ibmcolormap ibmcolormap;        /* colormap, used for ascii too! */
  398.  
  399. /* h19.c */
  400.  
  401.     short scrollcount;                    /* counts scrolled lines */
  402.     short curseekmode;                    /* VI mode moves cursor w/ vi commands */
  403.  
  404. /* vt100.c */
  405.     
  406.     short vtkeypad;                        /* user vt100 keypad mode */
  407.     unsigned short argarr[MAXARGS];        /* arguments for ANSI mode */
  408.     short argcount;                        /* # of arguments rec'd */
  409.     
  410.     short scrolltop;                     /* scrolling region top */
  411.     short scrollbottom;                    /* scrolling region bottom */
  412.     char vtaltkeypad;                    /* vt100 alternate keypad in effect */
  413.     char vt52altkeypad;                    /* vt100 alternate keypad in effect */
  414.     char vtaltcursor;                    /* vt alternate cursor mode */
  415.     char vtnewline;                        /* LF == NEWLINE ANSI mode */
  416.     char vtjumpscroll;                    /* jump/smooth scroll mode */
  417.     char decom;                            /* DEC origin mode in effect */
  418.     char wrapped;                         /* indicate wraparound was performed */
  419.  
  420.     short owrapped;                        /* following vars for save/restore cursor */
  421.     short odecom;
  422.     short ocharsetSO;
  423.     short oxpos;                         /* saved cursor position */
  424.     short oypos;                            
  425.     unsigned char ocharset;                /* saved charset */
  426.     unsigned char oattrib;                /* saved attrib */
  427.     
  428.     /* character set state */
  429.     unsigned char charsetSO;            /* G0 set shifted out? */
  430.     unsigned char charsetG0;            /* G0 character set */
  431.     unsigned char charsetG1;            /* G1 character set */
  432.     
  433.     /* h19key.c */
  434.     timer * timer25;        /* timer to reset the prompt line */
  435.     Point penloc25;
  436.     char line25[LINE25LEN];
  437.  
  438. /* per window prettywind.c */
  439.  
  440.     BitMap toprectbm;            /* bitmap copy of the top controls */
  441.     Rect bmdestrect;            /* the destrect */
  442.     short h19right;                /* right edge of emulator area */
  443.     short h19flagcenter;        /* point to place chars in labels */
  444.  
  445.     Rect qmarkrect;                /* TODO delete ? question mark box filling q2; if cursor hits, 
  446.                                     q3 labels get drawn */
  447.     Rect toprect;                /* rectangle containing top controls */
  448.     Rect countrect;                /* frames the counters */
  449.     Rect incountrect;            /* blanks input count */
  450.     Rect outcountrect;            /* blanks output count */
  451.     Rect shiftrect;                /* PF shift label */
  452.     Rect dubshiftrect;            /* PF double shift label */
  453.     Rect macrorect;                /* macro key interpretation label */
  454.     Rect syslockrect;            /* IBM system lock label */
  455.     Rect kbdlockrect;            /* IBM keyboard lock label */
  456.     
  457. /* controls on the window; emcursor.c prettywind.c */
  458.     
  459.     short iconhigh;                        /* is iconwindow highlighted? */
  460.     ControlHandle q1controls[Q1BUTMAX];    /* buttons at top */
  461.     short controlschanged;                /* controls in toprect need to be redrawn */
  462.     Rect shrinkrect;                    /* button at right which shrinks screen */
  463.         
  464. /* menu */
  465.     
  466.     char * seltype;                    /* -> "Screen" or "Selection" */
  467.     
  468. /* communication methods */
  469.  
  470. /* pointers to i/o functions */
  471.     int (*dotoken)();                /* -> current user input macro command handler */
  472.     int (*sendchar)();                /* -> routine to send a character to the host */
  473.     int (*sendstr)();                /* -> routine to send a string */
  474.     int (*putflush)();                /* -> routine to flush pending sends */
  475.     int (*putchar)();                /* -> routine to output a character */
  476.  
  477.     unsigned long in_cnt;
  478.     unsigned long out_cnt;                /* packet counts in and out */
  479.  
  480.     /* per window control structures for MacTCP in mactcp.c */
  481.     
  482.     long tcp_stream;
  483.     short mtcpconnopen;                    /* mactcp: a connection has been made */
  484.     short data_rcvd;                    /* data has been received on the stream */
  485.     short closeflag;                    /* connection has been closed */
  486.     short resending;                    /* TCP is resending... highlight counter */
  487.     
  488.     TCPiopb * tcp_conn;
  489.     TCPiopb * mtstream;                    /* stream block for mactcp */
  490.     
  491.     short send_wait;                    /* # tcp sends to wait for PB */
  492.     short resends;                        /* TCP # of resent packets */
  493.     
  494.     unsigned char * sendbuf;            /* circular buffer for sending */
  495.     unsigned char * fillp;                /* -> next empty char pos in buffer */
  496.     unsigned char * fillendp;            /* -> end of buffer */
  497.     unsigned char * sendp;                /* -> first char waiting to be sent */
  498.     unsigned short    fillcount;            /* # of chars in buffer */
  499.     unsigned short    waitcount;            /* # of chars waiting to be sent */
  500.     unsigned char * rcvbuf;                /* buffer handed to TCP for rcvs */
  501.  
  502.     /* serial port variables */
  503.  
  504.     short usebport;                /* TRUE use Printer Port, FALSE Modem Port */
  505.     short autohangup;            /* hangup serial line automatically on close */
  506.     unsigned long kin_cnt;
  507.     int xon;                    /* transmission on or off? */
  508.     
  509.     short refin;                /* driver ref # */
  510.     short refout;
  511.     short baud;                    /* Apple Serial Driver arg masks */
  512.     short parity;
  513.     short stop;
  514.     short data;
  515.  
  516. /* per window vars from ft.c for file transfer */
  517.     
  518.     short downvol;                /* download home volume for SFGET */
  519.     long downdir;                /* download home directory for SFGET */
  520.     short downvref;                /* volume ref num */
  521.     short resvref;                /* document volume ref num */
  522.     
  523.     Rect textrect;
  524.  
  525.     FILE *ft1;
  526.     unsigned char ft_flag;                    /* ft3270 flag bits */
  527.     unsigned char ack_buff[10];
  528.     
  529.     unsigned char *xfer1_buff;                /* large transfer buffer [MAXLEN] */
  530.     unsigned char *xfer2_buff;                /* small transfer buffer [20];    */
  531.     unsigned char *tbuff;                    /* [TBUFLEN];    */
  532.     unsigned char *ft3270_buff;                /* [TNFTLEN+10];*/
  533.     unsigned char *ftbuff;                    /* disk buffer [DOSLEN];    */
  534.     
  535.     unsigned char ftsavebuf[MAXLEN];        /* TODO dynamic? saves tcp stream until EOR [TNFTLEN+10];*/
  536.     unsigned char *ftsaveptr;                /* TODO dynamic? ptr into buffer */
  537.         
  538.     short ftlen;
  539.     short ftcnt;
  540.     short fnamelen;
  541.     short upload_cnt;
  542.     short input_cnt;
  543.     short input_state;
  544.     unsigned char extra;
  545.     unsigned char *ftptr;
  546.     unsigned char *ftname;
  547.     long fttotal;
  548.     long ftxfered;
  549.     long re_xmit;
  550.     short cft_count;            /* a counter for ft3270 */
  551.     
  552.     /* ftc19 packet structure used for upload & download */
  553.     
  554.     struct ftc19_pkt rcv_pkt;
  555.     struct ftc19_pkt send_pkt;
  556.     
  557.     Rect arcrect;            /* macintosh transfer status pie */
  558.     short arcdeg;
  559.     
  560.     short ibm_type;            /* kind of 3270 user has selected */
  561.     struct ibmcolormap colormap;        /* colormap of best matches */
  562.     
  563.     /* newly added vars */
  564.     short notrackcurs;        /* don't do cursor positioning with mouse */
  565. };
  566.  
  567. /* end of winds struct */
  568.  
  569. extern struct winds * conns[MAXWIND];
  570. extern short conncount;
  571.  
  572. extern struct winds * emdp;            /* pointer to emulator connection block we're using */
  573. extern struct winds * keydp;            /* pointer to top window connection block we're using */
  574.  
  575. extern WindowPtr    keywindow;            /* the top emulator window */ 
  576. extern WindowPtr    iconwindow;            /* top go-away window, shows tn3270 icon */
  577. extern WindowPtr    emwindow;            /* the output emulator window */ 
  578.  
  579. extern EventRecord    myEvent;
  580.  
  581. /* various macintosh emulator vars and flags */
  582.  
  583. extern short doubleclick;                /* a double click has occurred */
  584. extern short mousecurson;                /* is the mouse cursor hidden? */
  585. extern short inemulator;                /* an emulator is in use */
  586. extern short clickdelay;                /* # of ticks to wait before setting a selection */
  587. extern short modaldialog;                /* is a modaldialog active outside the Mac task?  skip event loop! */
  588. extern long creator;                    /* creator for file info */
  589.  
  590. extern short autokey;                /* indicates autokey is on */
  591. extern short autokeycommand;        /* indicates autokey-command was done */
  592. extern short autokeypersist;        /* indicates autokey has been on */
  593. extern timer *autokeywait;
  594. extern int clrautokeywait();
  595.  
  596. extern short iplog;                        /* enable logging of IP packets UNUSED */
  597. extern unsigned long cticks;            /* current # of ticks elapsed */
  598. extern unsigned long tickcursor;        /* next tick count to service cursor */
  599. extern unsigned long tickstats;            /* next tick count to display packet counters */
  600. extern unsigned long tickserial;        /* next tick count to check serial port */
  601. extern short serialwait;            /* how long the serial mgr thinks we should wait */
  602.  
  603. extern short connavailable;            /* an empty connection struct is lying about */
  604.  
  605. extern short cutcpopen;                /* Cornell TCP has been opened */
  606. extern short mactcpopen;            /* macTCP TCP has been initialized */
  607. extern short macipopen;                /* macTCP IP driver has been opened */
  608. extern short mtevent;                    /* Mactcp-- new data has arrived */
  609.  
  610. extern short mtcpsendasync;            /* use async send w/ MacTCP */
  611.  
  612. extern char copyerr[];
  613. extern short mfpresent;                    /* we're under MultiFinder */                        
  614.  
  615. extern long gettextscrap();
  616. extern long memtest();                    /* forward declaration */
  617.  
  618. extern short mfbackground;        /* doesn't really belong here */
  619. extern short keyboard;            /* keyboard type */
  620. extern short keypadswitch;            /* switch "Standard" keyboard keypad -,+ */
  621.  
  622. /* Cursors -- cross */
  623.  
  624. extern Cursor    target;
  625. extern Cursor    blank;
  626. extern Cursor * thecursor;
  627.  
  628. /* prettywind globals */
  629. extern short q3conth;                    /* height of quadrant 3 control button */
  630. extern short q3contskip;                /* size of skip every 3 buttons */
  631.  
  632. extern RgnHandle emclip;                /* holds previous em clip rect */
  633. extern RgnHandle q3clip;                /* for calculating new clip w/o q3 box */
  634. extern PicHandle shrinkpict;            /* picture for shrink control */
  635. extern PicHandle tapepict;                /* picture of cassette tape */
  636.  
  637. extern char * nosessionstr;            /* "No Active Session" */
  638. extern char * badaddress;            /* "Invalid host address" */
  639.  
  640. /* some important globals for scrinit.c follow */
  641.  
  642. extern SysPtr paramptr;            /* pointer to parameters for cursor blink time */
  643.  
  644. /* stuff for character image drawing */
  645.  
  646. extern FONTS font;
  647. extern FONTS invfont;
  648. extern FONTS boldfont;
  649. extern FONTS invboldfont;
  650. extern FONTS bvtfont;
  651. extern FONTS invbvtfont;
  652.  
  653. extern RgnHandle updateRgn;
  654.  
  655.  
  656. extern short bkrd_act;            /* is tcp running in background mode? */
  657.  
  658. /* mouserect sizing and tracking of cursor */
  659.  
  660. extern short trackon;            /* cursor tracking flag */
  661. extern Rect mouserect;                /* also used by h19curset to find the targeted x,y */
  662.  
  663. extern Rect dragrect;            /* the drag restriction rect */
  664.  
  665. extern char inselection;        /* flag that we are in selection range */
  666.  
  667. extern int selrestore();
  668.  
  669. extern long size23;                /* size of char array less one line */
  670. extern short linecount;            /* length of line in char array */
  671.  
  672. extern short scrollcount;        /* counts scrolled lines */
  673.  
  674. extern unsigned long modmask[];    /* masks for modflg */
  675.  
  676. /* emulator routine vectors */
  677.  
  678. extern int vt100();
  679. extern int vt100str();
  680. extern int h19();
  681. extern int h19str();
  682.  
  683. extern short trydsdraw;            /* *try* to use direct to screen drawing */
  684. extern short riskydsdraw;                /* only use dsdraw in FrontWindow() */
  685.  
  686. extern char zapuline;            /* dsdraw underline flag */
  687. extern char zapinvert;            /* dsdraw underline flag--font is inverted */
  688.  
  689. extern char skiparr[];            /* TRUE if character is a space */
  690. extern char allskiparr[];        /* alternate all-TRUE skiparr */
  691.  
  692. extern char isdiacritic[];        /* array of 0-width chars for QD drawing */
  693.  
  694.  
  695. /* emcursor stuff */
  696.  
  697. /* q3 vars */
  698. extern char * q3strings[];            /* strings for labels */
  699. extern char q3controls[];            /* ASCII send strings */
  700. extern char q3vtcontrols[];            /* ASCII VT100 send strings */
  701.  
  702. extern short topcontexist;            /* true if top controls exist */
  703.     
  704. /* token related stuff from key.c */
  705. #define    MAX_Q    1000                    /* large, mouse tracking adds a lot of actions */
  706.  
  707. extern short courierprint;                /* print using Courier on LaserWriters? */
  708.  
  709. /* from config.c */
  710. extern short appresfid;                    /* application resource file descriptor */
  711. extern short appvol;                    /* application home volume */
  712. extern long appdir;                        /* application home directory */
  713. extern short appvref;                    /* application volume ref num */
  714.  
  715. extern char * setfile;                    /* settings default filename */
  716. extern char * untfile;                    /* settings default filename */
  717.  
  718. extern short mfbackonly;                /* run only in background */
  719.  
  720. /* from scrinit.c */
  721. extern char * skiptest;                    /* current skip array to use in zap */
  722.  
  723.  
  724. /* BIGG per window variables copied into globals for better speed
  725.     and to avoid modifying zap.asm */
  726.  
  727. /* shared BIGG */
  728. extern FONTS *thefont;                /* BIGG */
  729. extern short xpos, ypos;            /* BIGG current x, y position */
  730. extern unsigned long    modflg;        /* BIGG line modified bit array */
  731. extern unsigned long clrflg;        /* BIGG line cleared bit array */
  732. extern short fontwidth;                /* BIGG width of font */
  733. extern short ** startarr;            /* BIGG dsdraw -> array of ptrs to scanline starts */
  734. extern short screenbytes;            /* BIGG width of screen in bytes */
  735. extern short screenrem;                /* BIGG screenbytes - std screen */
  736.  
  737. /* h19 BIGG */
  738. extern unsigned char * charp;            /* BIGG cursor loc for these arrays */
  739. extern short mode;                    /* BIGG interpretation mode of emulator */
  740. extern short inserton;                /* BIGG insert mode */
  741. extern short linelength;                /* BIGG width of row */
  742. extern short lastcol;                    /* BIGG linelength - 1 */
  743. extern unsigned char attrib;        /* BIGG normal/reverse mode for copy drawing */
  744. extern short wrap_around;                /* BIGG wrap at end of line if true */
  745.  
  746. /* 3270 BIGG */
  747. extern short cmdstate;                    /* BIGG state of the emulator */
  748. extern unsigned char *scr_map;            /* BIGG screen map */
  749. extern unsigned char *smap_end;        /* BIGG end of map */
  750. extern unsigned char *current_attr;    /* BIGG pointer to most recent attribute */
  751. extern unsigned char *cursor_ptr;        /* BIGG current cursor position in screen map */
  752. extern unsigned char * firstp;            /* BIGG ptr to first data byte processed for set_map */
  753.  
  754.  
  755. extern short scr_flag;                    /* BIGG */
  756.  
  757. /* vt100 BIGG */
  758.  
  759. extern short vtmode;                    /* BIGG new mode holder for vt100 */
  760. extern unsigned short * argp;            /* BIGG -> current argument */
  761.  
  762.  
  763. /* end BIGG vars */
  764.  
  765. extern short * chofftab9;                    /* array of character offsets to avoid multiplies */
  766. extern short * chofftab12;                    /* array of character offsets to avoid multiplies */
  767.  
  768. /* assembly utility vars */
  769. extern long long1;
  770. extern long long2;
  771. extern long long3;
  772. extern long long4;
  773.  
  774. extern TEHandle helptehand;
  775. extern WindowPtr helpwind;
  776. extern long filltimeout;
  777.  
  778. extern short edresetselect;            /* reset selection after emulator edit action */
  779.  
  780. extern char * malloc();
  781.  
  782. extern short quitonclose;                    /* quit when no windows open */
  783.  
  784. extern short tftpopen;                    /* has tftp been initialized? */
  785. extern short tftpserve;                /* act as a tftp server */
  786. extern short tftpask;                    /* query user about transfers */
  787.  
  788.  
  789. extern unsigned long    cursalarm;        /* tick count at which to change cursor */
  790.  
  791. extern Rect boxrect;                /* box in which the q3 button labels are drawn */
  792.  
  793. /* 3270 */
  794.  
  795. extern unsigned char ebctoasc[];        /* pointer to array containing EBCDIC chars     */
  796. extern unsigned char asctoebc[];        /* pointer to array containing ASCII chars         */
  797.  
  798. /* a structure to save font information for restoration */
  799.  
  800. struct fontsave {
  801.     short fontsize;
  802.     short fontid;
  803. };
  804.  
  805.  
  806.  
  807. #endif
  808.  
  809.  
  810. Handle setmacro();
  811.  
  812.